# -*- coding: utf-8 -*-
# @Time    : 2021/3/19 17:33
# @Author  : mokez
# @Email   : 1569089678@qq.com
# @File    : 质数和50以内的整数和.py
# @Software: PyCharm

# 打印1-50以内整数的和
sum = 0
for i in range(1, 51):
    sum += i
print(sum)

# 打印100-500以内的质数（只能被1和自己整除的数）
for j in range(100, 500):
    k = 2
    while k < j:
        if j % k == 0:
            break
        else:
            if k == (j - 1):
                print(f"{j}是质数")
            k += 1
